window.onload = function() {
	var selectPermissions = document.getElementsByName("hidPermissionSelect");

	for (i = 0; i < selectPermissions.length; i++) {
		var typeFg = selectPermissions[i].value;
		setValue("permissionSelect" + typeFg, typeFg);
	}
}

function user_saveSetting() {
	var arrUserId = new Array();
	var arrPermissionSel = new Array();
	var arrObjUserId = document.getElementsByName("hidUserId");
	var arrObjPermissionSel = document.getElementsByName("selPermissionSelect");

	
	for (i = 0; i < arrObjUserId.length; i++) {
		arrUserId[i] = arrObjUserId[i].value;
	}
	
	for (j = 0; j < arrObjPermissionSel.length; j++) {
		arrPermissionSel[j] = getDomValue(arrObjPermissionSel[j]);
	}
	
    ajaxRequest(getHost() + "user/permissionEdit/save", {
        "UserId"  : arrayToJson(arrUserId),
        "PermissionSel"  : arrayToJson(arrPermissionSel)
    }, user_saveSetting_callback);
}

function user_saveSetting_callback(data) {
	document.getElementById("permissionEditForm").action = getHost() + "user/permissionEdit/index";
    document.getElementById("permissionEditForm").submit();
}